<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="600px" @open="open" :append-to-body="true" :modal-append-to-body="true">
    <el-row>
      <el-col :span="24">
        变更类型:
        <el-select v-model="changeType" clearable>
          <el-option v-for="item in codeModel.sourceTypeList" :key="item.code" :label="item.name" :value="item.code" clearable />
        </el-select>
      </el-col>
    </el-row>
    <div slot="footer" class="dialog-footer">
      <el-button :type="'text'" @click="visible = false">取消</el-button>
      <el-button type="primary" @click="choose">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
  /** 子组件 */
  /** 工具类 */
  import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
  /** VUE配置 */
  export default {
    components: { },
    data() {
      return {
        title: '变更类型选择',
        urlPrefix: '/sd/projectUniversalChange/',
        url: {
          // 额外的url
        },
        changeType: "",
        visible: false,
        codeModel: {}
      }
    },
    methods: {
      choose() {
        if (!this.changeType) {
          this.$tap.alert("请选择变更类型")
          return
        }
        this.$emit('confirmChoose', this.changeType)
      },
      open() {
        this.visible = true
      },
      doQueryCode() {
        getAction(this.urlPrefix + "dataCodeList", {}).then((res) => {
          if (res.success) {
            this.codeModel = res.result
          } else {
            this.$tap.alert(res.message, 'warning')
          }
        })
      }
    },
    created() {
      this.doQueryCode()
    }
  }
</script>

